package chixing.day04;

/**
 * Account 账户类有以下属性
 * accNo  //账户账号
 * accName //账户姓名
 * accPassword  //账户密码
 * accTelno  //账户手机号
 * accBalance  //账户余额
 * accType //账户类型 0:储蓄账户， 1：信用账户
 * 账户类型 0表示储蓄账户， 1表示信用账户
 */
public class Account {
    private String accNo;
    private String accName;
    private String accPassword;
    private String accTelno;
    private double accBalance;//账户余额
    private int  accType;//账户类型 0表示储蓄账户， 1表示信用账户

    public Account(){}
    public Account(String accNo, String accName, String accPassword, String accTelno, double accBalance, int accType) {
        this.accNo = accNo;
        this.accName = accName;
        this.accPassword = accPassword;
        this.accTelno = accTelno;
        this.accBalance = accBalance;
        this.accType = accType;
    }

    public void depoist(double depoMoney){
        this.accBalance += depoMoney;
        System.out.println("存款成功!余额为:"+this.accBalance);
    }

    //余额不足的情况没考虑
    public void withdraw(double withMoney){
        if (this.accBalance >= withMoney){
            this.accBalance -= withMoney;
            System.out.println("取款成功!余额为:"+accBalance);
        }else {
            System.out.println("余额不足!您的余额为:"+accBalance);
        }
    }

    public String getAccNo() {
        return this.accNo;
    }

    public void setAccNo(String accNo) {
        this.accNo = accNo;
    }

    public String getAccName() {
        return this.accName;
    }

    public void setAccName(String accName) {
        this.accName = accName;
    }

    public String getAccPassword() {
        return this.accPassword;
    }

    public void setAccPassword(String accPassword) {
        this.accPassword = accPassword;
    }

    public String getSccTelno() {
        return this.accTelno;
    }

    public void setSccTelno(String sccTelno) {
        this.accTelno = sccTelno;
    }

    public double getAccBalance() {
        return this.accBalance;
    }

    public void setAccBalance(double accBalance) {
        this.accBalance = accBalance;
    }

    public int getAccType() {
        return this.accType;
    }

    public void setAccType(int accType) {
        this.accType = accType;
    }

    public String toString(){
        return "账户账号:" + accNo + "\n" +
                "账户姓名:" + accName + "\n" +
                "账户密码:" + accPassword + "\n" +
                "账户手机号:" + accTelno + "\n" +
                "账户余额:" + accBalance + "\n" +
                "账户类型:" + accType + "\n" ;
    }
}
